package com.meusconcursos.dataupdate;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

public abstract class BaseDataParser implements DataParser {

	final URL metadataUrl;

	protected BaseDataParser(String metadataUrl) {
		try {
			this.metadataUrl = new URL(metadataUrl);
		} catch (MalformedURLException e) {
			throw new RuntimeException(e);
		}
	}

	protected InputStream getInputStream() {
		try {
			return metadataUrl.openConnection().getInputStream();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

}
